﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using HomeStayWebCP.Models.BusinessObject;
using Mvc.Mailer;
using HomeStayWebCP.Mailers;

namespace HomeStayWebCP.Controllers
{
    public class SendmailController : Controller
    {
        //
        // GET: /Sendmail/
        MyMailer mailer = new MyMailer();

        public ActionResult Index()
        {
            return View();
        }
        [HttpPost]
        public ActionResult Sendmail(MailObject obj)
        {
            obj.ContactEmail = Session["ContactEmail"].ToString();
            obj.PostTitle = Session["PostTitle"].ToString();
           ////// MyMailer mailer = new MyMailer();
            mailer.Welcome(obj).Send();
            obj.Content = "";
            return PartialView(obj);
        }

        [HttpPost]
        public ActionResult SendmailBanUser(string title, string contactmail)
        {
          //  MyMailer mailer = new MyMailer();
            mailer.MailAcceptPost(title, contactmail).Send();
            return null;
        }

        [HttpPost]
        public ActionResult SendmailAccept(string title, string contactmail)
        {
            //MyMailer mailer = new MyMailer();
            mailer.MailAcceptPost(title, contactmail).Send();
            return null;
        }

        [HttpPost]
        public ActionResult SendmailReject(string title, string contactmail, string reason)
        {
           // MyMailer mailer = new MyMailer();
            mailer.MailRejectPost(title, contactmail, reason).Send();
            return null;
        }

    }
}
